import base from './baseapi'
import wepy from 'wepy';
import Tips from '../utils/Tips';


/**
 * 订单API接口数据
 */
export default class orderapi extends base {


    ///创建订单
    static async CreateOrderByShopCart(params) {
        //let data={index:"index",rand:`${Math.random()}`};
        let res = await this.postJson('vshop', 'Order/CreateOrderByShopCart', params);
        return res;
    }

    //微信支付
    static async GetWxaXcxPayRequest(orderid) {
        let data={orderId:orderid};
        let res = await this.get('vshop', 'WxPay/GetWxaXcxPayRequest', data);
        return res;
    }

    static async GetFreightFee(params) {
        let res = await this.postJson('vshop', 'Order/GetFreightFee', params);
        return res;
    }

    // 提交订单评价
    static async SubmitEvaluate(params) {
      let res = await this.postJson('vshop', 'Order/SubmitEvaluate', params);
      return res;
    }

    // 通过订单id获取订单信息
    static async GetOrderItemsByOrderNo(params) {
      let res = await this.get('vshop', 'Order/GetOrderItemsByOrderNo', params);
      return res;
    }

    // 上传评价图片
    static async UploadCommentImage(filePath,formData) {
      let res = await this.postFile('vshop', 'Member/UploadCommentImage', filePath,formData);
      return res;
    }

    // 删除评价图片
    static async DelPic(params) {
      let res = await this.postForm('vshop', 'Member/DelPic',params);
      return res;
    }

    //获取用户下单可用优惠券
    static async GetCouponList(data) {
      let res = await this.postJson('vshop', 'Order/GetCouponList',data );
      return res;
    }

    // 再来一单
    static async AddToShopCartByOrderNo(params) {
      let res = await this.postForm('vshop', 'ShopCart/AddToShopCartByOrderNo',params);
      return res;
    }

    // 确认收货
    static async SetFinishOrder(params) {
      let res = await this.postForm('vshop', 'Order/SetFinishOrder',params);
      return res;
    }

     // 获取支持的支付方式
     static async GetSupportPayment(params) {
      let res = await this.get('vshop', 'Order/GetSupportPayment', params);
      return res;
    }
}
